package com.guigu.array;

import java.util.Set;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class JSONArrayTest01 {

	public static void main(String[] args) {
		String json = "[{\"name\": \"xiaoD\", \"age\": \"21\"}," + "{\"name\": \"xiaoD2\", \"age\": \"22\"},"
				+ "{\"name\": \"xiaoD3\", \"age\": \"23\"}]";
		JSONArray jsonArray = JSONArray.parseArray(json);
		Object[] array = jsonArray.toArray();
		for (int i = 0; i < array.length; i++) {
			Object stringObject = array[i];
			JSONObject jsonObj = JSONObject.parseObject(stringObject.toString());
			System.out.println(jsonObj.toString() + "===" + jsonObj.entrySet());
			Set<String> keySet = jsonObj.keySet();
			for (String key : keySet) {
				Object object = jsonObj.get(key);
				System.err.println(key + "===" + object);
			}
		}

	}

}
